<template>
	<van-popup v-model:show="state.showCenter" :close-on-click-overlay="false" round teleport="body" class="auth-pup">
		<slot name="auth"></slot>
		<view class="close-btn" @click="closeFn()">
			<img src="@/assets/image/icon84.png">
		</view>
	</van-popup>
</template>

<script setup>
	import {
		nullLiteral
	} from "@babel/types";
	import {
		reactive,
		ref,
		getCurrentInstance,
		onMounted
	} from "vue"

	const state = reactive({
		show: false,
		actions: [{
				name: '删除'
			},
			{
				name: '仅自己可见'
			},
		],
		showCenter: props.types == 2 ? false : true
	})

	const props = defineProps({
		types: {
			type: Number,
			default: 1
		}
	})

	const squareFn = () => {
		state.showCenter = true
	}

	const squareHideFn = () => {
		state.showCenter = false
	}

	const closeFn = () => {
		let types = props.types
		// 1 返回上一页 2 关闭
		if (types == 1) {
			uni.navigateBack(-1)
		}
		if (types == 2) {
			state.showCenter = false
		}
	}

	defineExpose({
		squareFn,
		squareHideFn
	})
</script>

<style lang="scss" scoped>
	.close-btn {
		width: 80rpx;
		margin: 30rpx auto;

		img {
			width: 80rpx;
		}
	}

	.auth-pup {
		background: none !important;
		max-width: calc(100vw - var(--van-padding-md) * 4) !important;	
	}
</style>
